From: Helge Deller Date: Wed, 29 Jun 2022 13:53:55 +0000 (+0200) Subject: [2/4] fbmem: Check virtual screen sizes in fb_set_var() X-Git-Tag: archive/raspbian/5.10.127-2+rpi1^2~17 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/%22bookmarks:/?a=commitdiff_plain;h=9c1df3e727a5bad0f09d5e7e237a76c452f4b861;p=linux.git [2/4] fbmem: Check virtual screen sizes in fb_set_var() Origin: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit?id=b81212828ad19ab3eccf00626cd04099215060bf Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2021-33655 commit 6c11df58fd1ac0aefcb3b227f72769272b939e56 upstream. Verify that the fbdev or drm driver correctly adjusted the virtual screen sizes. On failure report the failing driver and reject the screen size change. Signed-off-by: Helge Deller Reviewed-by: Geert Uytterhoeven Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Greg Kroah-Hartman Gbp-Pq: Topic bugfix/all Gbp-Pq: Name fbmem-check-virtual-screen-sizes-in-fb_set_var.patch --- diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index bf61770f6f6..213e738d9eb 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1019,6 +1019,16 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) if (ret) return ret; + /* verify that virtual resolution >= physical resolution */ + if (var->xres_virtual < var->xres || + var->yres_virtual < var->yres) { + pr_warn("WARNING: fbcon: Driver '%s' missed to adjust virtual screen size (%ux%u vs. %ux%u)\n", + info->fix.id, + var->xres_virtual, var->yres_virtual, + var->xres, var->yres); + return -EINVAL; + } + if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) return 0;